.TH std::chrono::duration::operator++, 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::chrono::duration::operator++, \- std::chrono::duration::operator++,

.SH Synopsis

   duration& operator++();     \fB(1)\fP \fI(since C++11)\fP
                                   (constexpr since C++17)
   duration operator++( int ); \fB(2)\fP \fI(since C++11)\fP
                                   (constexpr since C++17)
   duration& operator--();     \fB(3)\fP \fI(since C++11)\fP
                                   (constexpr since C++17)
   duration operator--( int ); \fB(4)\fP \fI(since C++11)\fP
                                   (constexpr since C++17)

   Increments or decrements the number of ticks for this duration.

   If rep_ is a member variable holding the number of ticks in a duration object,

   1) Equivalent to ++rep_; return *this;.
   2) Equivalent to return duration(rep_++).
   3) Equivalent to --rep_; return *this;.
   4) Equivalent to return duration(rep_--);.

.SH Parameters

   \fI(none)\fP

.SH Return value

   1,3) A reference to this duration after modification.
   2,4) A copy of the duration made before modification.

.SH Example


// Run this code

 #include <chrono>
 #include <iostream>

 int main()
 {
     std::chrono::hours h(1);
     std::chrono::minutes m = ++h;
     m--;
     std::cout << m.count() << " minutes\\n";
 }

.SH Output:

 119 minutes

.SH See also

   operator+=
   operator-= implements compound assignment between two durations
   operator*= \fI(public member function)\fP
   operator/=
   operator%=
   operator+
   operator-
   operator*  implements arithmetic operations with durations as arguments
   operator/  \fI(function template)\fP
   operator%
   \fI(C++11)\fP
